package com.iplay.实战java高并发程序设计.chapter3.c34;

import ch.qos.logback.core.util.TimeUtil;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.util.concurrent.TimeUnit;

/**
 * @author dangwu
 * @since 2021/11/2 6:49 下午
 */
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public class JMHSample_01_HelloWorld {
    @Benchmark
    public void wellHelloThere() throws InterruptedException {
        //this method was intentionally left blank.
        TimeUnit.MILLISECONDS.sleep(100);
    }

    public static void main(String[] args) throws RunnerException {
        Options build = new OptionsBuilder().include(JMHSample_01_HelloWorld.class.getSimpleName())
                .forks(1).build();
        new Runner(build).run();
    }
}
